package com.mdd.service.order.impl;

import com.alibaba.fastjson.JSON;
import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.request.AlipayTradeOrderinfoSyncRequest;
import com.alipay.api.response.AlipayTradeOrderinfoSyncResponse;
import com.mdd.service.order.TradeOrderInfoService;
import lombok.extern.slf4j.Slf4j;
import com.mdd.validate.order.TradeOrderInfo;
import org.springframework.stereotype.Service;

/**
 * 履约订单业务情况同步
 * <p>
 * {@code @Description}
 * @Author 幻速
 * {@code @Date} 2023/10/30 19:47
 **/
@Slf4j
@Service
public class TradeOrderInfoServiceImpl implements TradeOrderInfoService {
    @Override
    public AlipayTradeOrderinfoSyncResponse orderInfoSync(AlipayClient alipayClient, TradeOrderInfo tradeOrderInfo) throws AlipayApiException {
        log.info("AlipayTradeOrderinfoSyncRequest params------>"+JSON.toJSONString(tradeOrderInfo));
        AlipayTradeOrderinfoSyncRequest request = new AlipayTradeOrderinfoSyncRequest();
        request.setBizContent(JSON.toJSONString(tradeOrderInfo));
        AlipayTradeOrderinfoSyncResponse response = alipayClient.execute(request);
        log.info("AlipayTradeOrderinfoSyncResponse----->"+JSON.toJSONString(response));
        return response;
    }
}
